<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:icecore="http://www.icefaces.org/icefaces/core" 
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ice="http://www.icesoft.com/icefaces/component"
      xmlns:comp="http://facelets.componentes.com">

    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link href="./resources/css/default.css" rel="stylesheet" type="text/css" />
        <link href="./resources/css/stylesheet.css" rel="stylesheet" type="text/css" />
        <script src="resources/mascara.js" type="text/javascript"></script>
        <link rel="stylesheet" type="text/css" href="./xmlhttp/css/rime/rime.css"/>
        <title>
            Consulta de Objetivos e Pontos
        </title>

    </h:head>

    <h:body  styleClass="ice-skin-rime" style="background-image: url(resources/fundo.jpg) ">                
        <div id="geral">
            <h:form id="consulta">
                <icecore:singleSubmit/>







                <div id="menu" style="background-image: url(./resources/menuPlat2.png);" >

                    <ice:panelGrid columns="2" style=" width: 100%; border:solid 0px green">
                        <ice:panelGroup style="text-align:left; width:820px">
                            <ice:outputText style="font-weight: bold; margin-top: -15px; margin-left: 0px" value="Olá, #{acoesDoUsuario.usuarioConectado.nomePessoa}"/>                        
                        </ice:panelGroup>
                        <ice:panelGroup style="text-align:right">
                            <ice:panelGrid style="text-align:right; margin-left:50px" columns="3">
                                <ice:commandButton rendered="true" style="margin-top: -13px;  " actionListener="#{centralPush.chamarPush}" image="resources/btTutorial.png" title="Tutorial" />

                                <ice:commandButton rendered="true" style="margin-top: -13px; margin-left: 10px " actionListener="#{acoesDoUsuario.sairDaPlataforma}" value="Sair" image="resources/btExit.png" title="Sair da Plataforma" />
                                <ice:outputConnectionStatus style="margin-top: -5px; margin-left: 10px;"  />
                            </ice:panelGrid>
                        </ice:panelGroup>


                    </ice:panelGrid>
                </div>


                <div   id="conteudo">

                    <ice:panelGroup style=" width:1000px; min-height: 500px; text-align:left; height:100%; border:solid 0px red ">                
                        <!--CONSULTA-->
                        <ice:panelCollapsible toggleOnClick="false"  styleClass="iceConsultabl" style="border:solid 0px red"  id="formPanel" expanded="true">
                            <f:facet   name="header">
                                <ice:panelGroup style="color: black">
                                    <ice:outputText  id="formHeader" value="Consulta de Objetivos e Pontos"/>                                    
                                </ice:panelGroup>
                            </f:facet>                            
                            <ice:panelGrid style="margin-left:5px; width: 930px; text-align:left; font-size: 14px">
                                <ice:panelGrid columns="5" style="border:1px solid silver">
                                    <ice:panelGrid columns="2" style="margin-top:-7px" >
                                        <ice:outputText  value="Estratégia:"/>
                                        <ice:selectOneMenu    converter="entidadeConverter" style="width: 300px; " value="#{conEstrategiasCalculadasController.estrategiaSelecionada}" >
                                            <f:selectItems   value="#{acoesDoUsuario.estrategiasDoUsuario}"/>
                                        </ice:selectOneMenu>
                                    </ice:panelGrid>    
                                    <comp:campoDataNormal id="dataInicio" readonly="false" label="Data Inicial" value="#{conEstrategiasCalculadasController.dataInicial}"/>                                    
                                    <comp:campoDataNormal id="dataFim" readonly="false" label="Data Final" value="#{conEstrategiasCalculadasController.dataFinal}"/>
                                    <ice:commandButton style="margin-left:63px" actionListener="#{botoes.controllerPagina.consultaEspecifica}" image="/resources/btConsultar.png" immediate="false" title="Consultar os Registros" />                                    
                                </ice:panelGrid>
                                <ice:panelGroup>
                                    <comp:msg for="dataInicio"/>
                                    <comp:msg for="dataFim"/>
                                    <ice:messages errorClass="errorMessage" fatalClass="fatalMessage" globalOnly="true" id="messages1" infoClass="infoMessage"
                                                  showDetail="true" showSummary="true" style="color: red; border:solid 1px red" warnClass="warnMessage"/>
                                </ice:panelGroup>




                                <ice:panelGrid   style="border:solid 1px silver; height:400px" >
                                    <ice:panelGroup  style="text-align: center; width: 965px; overflow: auto; border: solid 0px red; height: 430px" >
                                        <ice:dataTable   resizable="true"   cellpadding="0" headerClass="icelist-header" rowClasses="icelist-row-even,icelist-row-odd" style="font-size:14px; margin-top: -1px" value="#{botoes.controllerPagina.rowModel}"
                                                         width="948px; " var="currentRow" clientOnly="true" columnWidths="100px,80px, 100px,100px,100px,100px,100px, 45px, 50px"  >
                                            <ice:column>
                                                <ice:outputText converter="converteData" style="font-weight: bold" value="#{currentRow['dataUtilizacao']}"/>
                                                <f:facet name="header">
                                                    <ice:outputText value="Data Operação"/>
                                                </f:facet>
                                            </ice:column>
                                            <ice:column>
                                                <ice:panelGrid>
                                                    <ice:outputText style="color: blue; font-weight: bold" value="COMPRA"/>
                                                    <ice:outputText style="color: green; font-weight: bold" value="VENDA"/>
                                                </ice:panelGrid>
                                                <f:facet name="header">
                                                    <ice:outputText  value="OPERAÇÃO"/>
                                                </f:facet>
                                            </ice:column>
                                            <ice:column>
                                                <ice:panelGrid style="#{(currentRow['alcancadoCompra'] != null) ? 'font-weight: bold; color:blue; text-align: left' : 'color:blue; text-align: left'}">
                                                    <ice:panelGrid columns="2">
                                                        <ice:outputText converter="converteTresDig"  value="#{(currentRow['mostrarEntradas'] == 'S') ? currentRow['comprar'] : ''}"/>
                                                        <ice:outputText rendered="#{currentRow['alcancadoCompra'] == null}" value="-"/>
                                                        <ice:panelGrid columns="3" rendered="#{currentRow['alcancadoCompra'] != null}">
                                                            <ice:commandButton image="resources/atingiuPonto.png" style="width: 16px; height: 16px"/>
                                                        </ice:panelGrid>
                                                    </ice:panelGrid>
                                                </ice:panelGrid>                                                                                                                                
                                                <ice:panelGrid style="#{(currentRow['alcancadoVenda'] != null) ? 'font-weight: bold; color:green' : 'color:green'}" columns="2">
                                                    <ice:panelGrid columns="2">   
                                                        <ice:outputText converter="converteTresDig"  value="#{(currentRow['mostrarEntradas'] == 'S') ? currentRow['vender'] : ''}"/>
                                                        <ice:outputText rendered="#{currentRow['alcancadoVenda'] == null}" value="-"/>
                                                        <ice:panelGrid columns="3" rendered="#{currentRow['alcancadoVenda'] != null}">
                                                            <ice:commandButton image="resources/atingiuPonto.png" style="width: 16px; height: 16px"/>
                                                        </ice:panelGrid>
                                                    </ice:panelGrid>                                                                                    
                                                </ice:panelGrid>

                                                <f:facet name="header">
                                                    <ice:outputText  value="COMPRAR/VENDER"/>
                                                </f:facet>
                                            </ice:column>
                                            <ice:column>
                                                <ice:panelGrid style="#{(currentRow['alcancadoStopCompra'] != null) ? 'font-weight: bold; color:blue' : 'color:blue'}" columns="2">
                                                    <ice:panelGrid columns="2">
                                                        <ice:outputText converter="converteTresDig"  value="#{(currentRow['mostrarEntradas'] == 'S') ? currentRow['stopSegurancaComprar'] : ''}"/>
                                                        <ice:outputText rendered="#{currentRow['alcancadoStopCompra'] == null}" value="-"/>
                                                        <ice:panelGrid columns="4" rendered="#{currentRow['alcancadoStopCompra'] != null}">
                                                            <ice:commandButton image="resources/atingiuStop.png" style="width: 16px; height: 16px"/>
                                                            <ice:outputText value="("/>
                                                            <ice:outputText converter="convertePontos"  value="#{currentRow['stopSegurancaComprar'] - currentRow['comprar'] }"/>
                                                            <ice:outputText value=")"/>
                                                        </ice:panelGrid>
                                                    </ice:panelGrid>
                                                </ice:panelGrid>
                                                <ice:panelGrid style="#{(currentRow['alcancadoStopVenda'] != null) ? 'font-weight: bold; color:green' : 'color:green'}" columns="2">
                                                    <ice:panelGrid columns="2">
                                                        <ice:outputText converter="converteTresDig"  value="#{(currentRow['mostrarEntradas'] == 'S') ? currentRow['stopSegurancaVender'] : ''}"/>
                                                        <ice:outputText rendered="#{currentRow['alcancadoStopVenda'] == null}" value="-"/>
                                                        <ice:panelGrid columns="4" rendered="#{currentRow['alcancadoStopVenda'] != null}">
                                                            <ice:commandButton image="resources/atingiuStop.png" style="width: 16px; height: 16px"/>
                                                            <ice:outputText value="("/>
                                                            <ice:outputText converter="convertePontos"  value="#{currentRow['vender'] - currentRow['stopSegurancaVender'] }"/>
                                                            <ice:outputText value=")"/>
                                                        </ice:panelGrid>
                                                    </ice:panelGrid>
                                                </ice:panelGrid>
                                                <f:facet name="header">
                                                    <ice:outputText  value="STOP"/>
                                                </f:facet>
                                            </ice:column>
                                            <ice:column>
                                                <ice:panelGrid style="#{(currentRow['alcancadoCompraSaida1'] != null) ? 'font-weight: bold; color:blue' : 'color:blue'}" columns="2">
                                                    <ice:panelGrid columns="2">
                                                        <ice:outputText converter="converteTresDig"  value="#{(currentRow['mostrarEntradas'] == 'S') ? currentRow['comprarSaida1'] : ''}"/>
                                                        <ice:outputText rendered="#{currentRow['alcancadoCompraSaida1'] == null}" value="-"/>
                                                        <ice:panelGrid columns="4" rendered="#{currentRow['alcancadoCompraSaida1'] != null}">
                                                            <ice:commandButton image="resources/atingiuPonto.png" style="width: 16px; height: 16px"/>
                                                            <ice:outputText value="("/>
                                                            <ice:outputText converter="convertePontos"  value="#{currentRow['comprarSaida1'] - currentRow['comprar']}"/>
                                                            <ice:outputText value=")"/>
                                                        </ice:panelGrid>
                                                    </ice:panelGrid>
                                                </ice:panelGrid>
                                                <ice:panelGrid style="#{(currentRow['alcancadoVendaSaida1'] != null) ? 'font-weight: bold; color:green' : 'color:green'}" columns="2">
                                                    <ice:panelGrid columns="2">
                                                        <ice:outputText converter="converteTresDig"  value="#{(currentRow['mostrarEntradas'] == 'S') ? currentRow['venderSaida1'] : ''}"/>
                                                        <ice:outputText rendered="#{currentRow['alcancadoVendaSaida1'] == null}" value="-"/>
                                                        <ice:panelGrid columns="4" rendered="#{currentRow['alcancadoVendaSaida1'] != null}">
                                                            <ice:commandButton image="resources/atingiuPonto.png" style="width: 16px; height: 16px"/>
                                                            <ice:outputText value="("/>
                                                            <ice:outputText converter="convertePontos"  value="#{currentRow['vender'] - currentRow['venderSaida1'] }"/>
                                                            <ice:outputText value=")"/>
                                                        </ice:panelGrid>
                                                    </ice:panelGrid>
                                                </ice:panelGrid>
                                                <f:facet name="header">
                                                    <ice:outputText  value="GANHO 1"/>
                                                </f:facet>
                                            </ice:column>
                                            <ice:column>
                                                <ice:panelGrid style="#{(currentRow['alcancadoCompraSaida2'] != null) ? 'font-weight: bold; color:blue' : 'color:blue'}" columns="2">
                                                    <ice:panelGrid columns="2">
                                                        <ice:outputText converter="converteTresDig"  value="#{(currentRow['mostrarEntradas'] == 'S') ? currentRow['comprarSaida2'] : ''}"/>
                                                        <ice:outputText rendered="#{currentRow['alcancadoCompraSaida2'] == null}" value="-"/>
                                                        <ice:panelGrid columns="4" rendered="#{currentRow['alcancadoCompraSaida2'] != null}">
                                                            <ice:commandButton image="resources/atingiuPonto.png" style="width: 16px; height: 16px"/>
                                                            <ice:outputText value="("/>
                                                            <ice:outputText converter="convertePontos"  value="#{currentRow['comprarSaida2'] - currentRow['comprar']}"/>
                                                            <ice:outputText value=")"/>
                                                        </ice:panelGrid>   
                                                    </ice:panelGrid>
                                                </ice:panelGrid>
                                                <ice:panelGrid style="#{(currentRow['alcancadoVendaSaida2'] != null) ? 'font-weight: bold; color:green' : 'color:green'}" columns="2">
                                                    <ice:panelGrid columns="2">
                                                        <ice:outputText converter="converteTresDig"  value="#{(currentRow['mostrarEntradas'] == 'S') ? currentRow['venderSaida2'] : ''}"/>
                                                        <ice:outputText rendered="#{currentRow['alcancadoVendaSaida2'] == null}" value="-"/>
                                                        <ice:panelGrid columns="4" rendered="#{currentRow['alcancadoVendaSaida2'] != null}">
                                                            <ice:commandButton image="resources/atingiuPonto.png" style="width: 16px; height: 16px"/>
                                                            <ice:outputText value="("/>
                                                            <ice:outputText converter="convertePontos"  value="#{currentRow['vender'] - currentRow['venderSaida2'] }"/>
                                                            <ice:outputText value=")"/>
                                                        </ice:panelGrid>
                                                    </ice:panelGrid>
                                                </ice:panelGrid>
                                                <f:facet name="header">
                                                    <ice:outputText  value="GANHO 2"/>
                                                </f:facet>
                                            </ice:column>
                                            <ice:column>
                                                <ice:panelGrid style="#{(currentRow['alcancadoCompraSaida3'] != null) ? 'font-weight: bold; color:blue' : 'color:blue'}" columns="2">
                                                    <ice:panelGrid columns="2">
                                                        <ice:outputText converter="converteTresDig"  value="#{(currentRow['mostrarEntradas'] == 'S') ? currentRow['comprarSaida3'] : ''}"/>
                                                        <ice:outputText rendered="#{currentRow['alcancadoCompraSaida3'] == null}" value="-"/>
                                                        <ice:panelGrid columns="4" rendered="#{currentRow['alcancadoCompraSaida3'] != null}">
                                                            <ice:commandButton image="resources/atingiuPonto.png" style="width: 16px; height: 16px"/>
                                                            <ice:outputText value="("/>
                                                            <ice:outputText converter="convertePontos"  value="#{currentRow['comprarSaida3'] - currentRow['comprar']}"/>
                                                            <ice:outputText value=")"/>
                                                        </ice:panelGrid>
                                                    </ice:panelGrid>
                                                </ice:panelGrid>
                                                <ice:panelGrid style="#{(currentRow['alcancadoVendaSaida3'] != null) ? 'font-weight: bold; color:green' : 'color:green'}" columns="2">
                                                    <ice:panelGrid columns="2">
                                                        <ice:outputText converter="converteTresDig"  value="#{(currentRow['mostrarEntradas'] == 'S') ? currentRow['venderSaida3'] : ''}"/>
                                                        <ice:outputText rendered="#{currentRow['alcancadoVendaSaida3'] == null}" value="-"/>
                                                        <ice:panelGrid columns="4" rendered="#{currentRow['alcancadoVendaSaida3'] != null}">
                                                            <ice:commandButton image="resources/atingiuPonto.png" style="width: 16px; height: 16px"/>
                                                            <ice:outputText value="("/>
                                                            <ice:outputText converter="convertePontos"  value="#{currentRow['vender'] - currentRow['venderSaida3'] }"/>
                                                            <ice:outputText value=")"/>
                                                        </ice:panelGrid>
                                                    </ice:panelGrid>
                                                </ice:panelGrid>
                                                <f:facet name="header">
                                                    <ice:outputText  value="GANHO 3"/>
                                                </f:facet>
                                            </ice:column>

                                            <ice:column>
                                                <ice:panelGrid  columns="1">
                                                    <ice:outputText converter="convertePontos" style="#{currentRow['pontos'] >= 0 ? 'color: blue' : 'color: red'}" value="#{currentRow['pontos']}"/>                                            
                                                </ice:panelGrid>
                                                <f:facet name="header">
                                                    <ice:outputText style="color : black" value="PONTOS"/>
                                                </f:facet>
                                            </ice:column>
                                             <ice:column>
                                                <ice:panelGrid  columns="1">
                                                    <ice:outputText converter="converteLucros" style="#{currentRow['pontos'] >= 0 ? 'color: blue' : 'color: red'}" value="#{((currentRow['pontos'] * 0.2) / 500) * 100}"/>                                            
                                                </ice:panelGrid>
                                                <f:facet name="header">
                                                    <ice:outputText style="color : black" value="% Lucro"/>
                                                </f:facet>
                                            </ice:column>
                                        </ice:dataTable>
                                    </ice:panelGroup>
                                    <ice:panelGrid columns="4" style="border: solid 0px green">
                                        <ice:commandButton  image="resources/btPrimeira.png" rendered="#{botoes.controllerPagina.paginaAtual != 0}"  title="Primeira Página" action="#{botoes.controllerPagina.primeiraPagina}"/>
                                        <ice:commandButton  image="resources/btAnt.png" rendered="#{botoes.controllerPagina.paginaAtual != 0}" style="margin-left: 10px" title="Página Anterior" action="#{botoes.controllerPagina.anterior}"/>
                                        <ice:commandButton  image="resources/btProx.png" rendered="#{botoes.controllerPagina.total &gt; botoes.controllerPagina.proximaPagina}" style="margin-left: 10px"  title="Próxima Página"  action="#{botoes.controllerPagina.proxima}"/>
                                        <ice:commandButton  image="resources/btUltimo.png" title="Última Página" style="margin-left: 10px" rendered="#{botoes.controllerPagina.total &gt; botoes.controllerPagina.proximaPagina}"  action="#{botoes.controllerPagina.ultimaPagina}"/>
                                       
                                    </ice:panelGrid>
   
                                    <ice:panelGrid columns="2" style="border: 1px solid silver; width: 960px;" >
                                        <ice:panelGrid columns="8" style="font-size:13px; width: 450px; border: 1px solid silver; text-align: left">
                                            <ice:outputText style="color : black; font-weight: bold" value="Qt Stops:"/>
                                            <ice:outputText style="color : red" value="#{conEstrategiasCalculadasController.qtdeStops}"/>
                                            <ice:outputText style="color : black; font-weight: bold" value="Qt Ganho1:"/>
                                            <ice:outputText style="color : blue" value="#{conEstrategiasCalculadasController.qtdeGanho1}"/>
                                            <ice:outputText style="color : black; font-weight: bold" value="Qt Ganho2:"/>
                                            <ice:outputText style="color : blue" value="#{conEstrategiasCalculadasController.qtdeGanho2}"/>
                                            <ice:outputText style="color : black; font-weight: bold" value="Qt Ganho3:"/>
                                            <ice:outputText style="color : blue" value="#{conEstrategiasCalculadasController.qtdeGanho3}"/>                                 
                                            <ice:outputText style="color : black; font-weight: bold" value="Stops:"/>                                       
                                            <ice:outputText style="color : red" converter="convertePontos" value="#{conEstrategiasCalculadasController.totalStops}"/>
                                            <ice:outputText style="color : black; font-weight: bold" value="Ganhos:"/>
                                            <ice:outputText style="color : blue" converter="convertePontos" value="#{conEstrategiasCalculadasController.totalGanhos}"/>
                                            <ice:outputText style="color : black; font-weight: bold" value="Saldo:"/>
                                            <ice:outputText style="#{(conEstrategiasCalculadasController.totalPontos >= 0) ? 'color : blue' : 'color : red'}" converter="convertePontos" value="#{conEstrategiasCalculadasController.totalPontos}"/>
                                        </ice:panelGrid>
                                        <ice:panelGrid columns="6"  style="font-size:13px; margin-left: 0px; border: 1px solid silver; text-align: left; width:500px">
                                           
                                            <ice:outputText style="color : black; font-weight: bold" value="Saldo Ganho 1:"/>
                                            <ice:outputText style="#{(conEstrategiasCalculadasController.totalPontosSaindoNoObj1 >= 0) ? 'color : blue' : 'color : red'}" converter="convertePontos" value="#{conEstrategiasCalculadasController.totalPontosSaindoNoObj1}"/>
                                            <ice:outputText style="color : black; font-weight: bold" value="Saldo Ganho 2:"/>
                                            <ice:outputText style="#{(conEstrategiasCalculadasController.totalPontosSaindoNoObj2 >= 0) ? 'color : blue' : 'color : red'}" converter="convertePontos" value="#{conEstrategiasCalculadasController.totalPontosSaindoNoObj2}"/>
                                            <ice:outputText style="color : black; font-weight: bold" value="Saldo Ganho 3:"/>
                                            <ice:outputText style="#{(conEstrategiasCalculadasController.totalPontosSaindoNoObj3 >= 0) ? 'color : blue' : 'color : red'}" converter="convertePontos" value="#{conEstrategiasCalculadasController.totalPontosSaindoNoObj3}"/>
                                             <ice:outputText style="color : black; font-weight: bold" value="% Lucro 1:"/>
                                            <ice:outputText style="#{(conEstrategiasCalculadasController.totalPontosSaindoNoObj1 >= 0) ? 'color : blue' : 'color : red'}" converter="converteLucros" value="#{((conEstrategiasCalculadasController.totalPontosSaindoNoObj1 * 0.2) / 500) * 100}"/>
                                            <ice:outputText style="color : black; font-weight: bold" value="% Lucro 2:"/>
                                            <ice:outputText style="#{(conEstrategiasCalculadasController.totalPontosSaindoNoObj2 >= 0) ? 'color : blue' : 'color : red'}" converter="converteLucros" value="#{((conEstrategiasCalculadasController.totalPontosSaindoNoObj2 * 0.2) / 500) * 100}"/>
                                            <ice:outputText style="color : black; font-weight: bold" value="% Lucro 3:"/>
                                            <ice:outputText style="#{(conEstrategiasCalculadasController.totalPontosSaindoNoObj3 >= 0) ? 'color : blue' : 'color : red'}" converter="converteLucros" value="#{((conEstrategiasCalculadasController.totalPontosSaindoNoObj3 * 0.2) / 500) * 100}"/>
                                        </ice:panelGrid>
                                    </ice:panelGrid>
                                </ice:panelGrid>
                            </ice:panelGrid>
                        </ice:panelCollapsible>
                    </ice:panelGroup>

                </div>

                <div id="rodape" style="background-image: url(./resources/rodapePlat.png)"  >
                   
                    <ice:panelGrid columns="2" style="margin-left:10px" >
                        <ice:outputText style="color:red; font-weight: bold" value="OBS: % LUCRO BRUTO BASEADO EM CONTRATOS NO VALOR DE R$ 500,00"/>
                        <ice:commandButton style="margin-left:420px" title="Voltar a Plataforma" value="Plataforma" image="/resources/btPlataforma.png" actionListener="#{navegaEntrePaginas.navegarPlataforma}"/>
                    </ice:panelGrid>
                </div>


            </h:form>                
        </div>
    </h:body>

</html>      